from django.conf.urls import url, include
from django.contrib import admin
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.routers import DefaultRouter

from .views import statistical, users, specs, images, skus, orders,\
   permissions, groups, admins

urlpatterns = [
   # """statistical"""
   url(r'^authorizations/$', obtain_jwt_token),
   url(r'^statistical/total_count/$', statistical.UserCountView.as_view()),
   url(r'^statistical/day_increment/$', statistical.UserDayIncrementView.as_view()),
   url(r'^statistical/day_active/$', statistical.UserDayActiveCountView.as_view()),
   url(r'^statistical/day_orders/$', statistical.UserDayOrdersCountView.as_view()),
   url(r'^statistical/month_increment/$', statistical.UserMonthIncrementView.as_view()),
   url(r'^statistical/goods_day_views/$', statistical.UserGoodsVisitCountView.as_view()),
   # '''users'''
   url(r'^users/$', users.UsersView.as_view()),
   url(r'^goods/simple/$', specs.SpecsView.as_view({'get': 'simple'})),
   url(r'^goods/(?P<pk>\d+)/specs/$', skus.SkusView.as_view({'get': 'specs'})),
   url(r'^permission/content_types/$', permissions.PermissionViews.as_view({'get': 'content_type'})),
   url(r'^skus/simple/$', images.ImagesView.as_view({'get': 'simple'})),
   url(r'^permission/simple/$', groups.GroupView.as_view({'get': 'simple'})),
   url(r'^permission/groups/simple/$', admins.AdminsView.as_view({'get': 'simple'})),

]

router = DefaultRouter()
router.register('goods/specs', specs.SpecsView, basename='specs')
urlpatterns += router.urls

router = DefaultRouter()
router.register('skus/images', images.ImagesView, basename='images')
urlpatterns += router.urls


router = DefaultRouter()
router.register('skus', skus.SkusView, basename='skus')
urlpatterns += router.urls


router = DefaultRouter()
router.register('orders', orders.OrdersView, basename='orders')
urlpatterns += router.urls

router = DefaultRouter()
router.register('permission/perms', permissions.PermissionViews, basename='perms')
urlpatterns += router.urls


router = DefaultRouter()
router.register('permission/groups', groups.GroupView, basename='groups')
urlpatterns += router.urls


router = DefaultRouter()
router.register('permission/admins', admins.AdminsView, basename='admins')
urlpatterns += router.urls
